<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>申报用户管理</title>
<link rel="stylesheet" type="text/css" href="../css/blueprint/screen.css" media="screen, projection"/>
<link rel="stylesheet" type="text/css" href="../css/blueprint/plugins/buttons/screen.css" media="screen, projection"/>
<script type="text/javascript" src="../script/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../script/jquery.plugin.tablecross-0.1.js"></script>
<script type="text/javascript" src="../script/jquery.plugin.pageit-0.1.js"></script>
<script type="text/javascript" src="../script/jquery.plugin.ajaxtip-0.1.js"></script>
<script type="text/javascript">
var queryVO = {};
$(document).ready(function() {
	$("#planUserDataTable").ajaxProccessTip();
    getPlanUserData(queryVO, 1, 10);
    $("#pageBar").pageListener(getPlanUserData, queryVO);
    $("#DELETE_BUTTON").click(function() {
    	if ($(".select_box:checked").length == 0) {
        	alert('请选择要删除的用户');
    	} else {
    		$("#PLANUSER_FORM").attr("action", "DeletePlanUser.action");
    		$("#PLANUSER_FORM").submit();
    	}
	});
	$("#EDIT_BUTTON").click(function() {
    	if ($(".select_box:checked").length == 0) {
        	alert('请选择1个要编辑的用户');
    	} else if ($(".select_box:checked").length != 1) {
    		alert('只能选择1个要编辑的用户');
    	} else {
    		$("#PLANUSER_FORM").attr("action", "EditPlanUser.action");
    		$("#PLANUSER_FORM").submit();
    	}
	});
});
function getPlanUserData(queryVO, pageIndex, pageSize) {
    $.ajax({
        type: "post",
        url:  "ListPlanUser.action",
        data: {"pageVO.pageIndex": pageIndex, "pageVO.pageSize": pageSize},
        dataType: "json",
        success: function(data) {
        	if (data == null) {
                alert('非法的请求，请确认你是否有权限执行该操作！');
                return;
            }
            var strArr = new Array();
            for (var i = 0; i < data.planUserList.length; i++) {
                strArr.push('<tr>');
                strArr.push('<td><input type="checkbox" name="userId" class="select_box" value="' + data.planUserList[i].uid + '" /></td>');//号
                strArr.push('<td>' + data.planUserList[i].username + '</td>');
                strArr.push('<td>' + (data.planUserList[i].unitName != null ? data.planUserList[i].unitName : "") + '</td>');
                strArr.push('<td>' + (data.planUserList[i].planName != null ? data.planUserList[i].planName : "") + '</td>');
                strArr.push('<td>' + (data.planUserList[i].enabled == 1 ? "启用" : "") + '</td>');
                strArr.push('</tr>');
            }
            $("#planUserDataBody").html(strArr.join(''));
            $("#pageBar").pageRender(data.pageVO.pageIndex, data.pageVO.pageSize, data.pageVO.pageNum);
            $("#planUserDataBody").tablecross('', 'odd', 'over');
        }
    });
}
</script>
<style type="text/css">
tr.odd td {
    background: #ecf6fc;
}

tr.over td {
    background: #bcd4ec;
}
</style>
</head>
<body>
<form id="PLANUSER_FORM" action="" method="post">
<table style="margin-bottom: 0px" width="98%" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td width="80%" style="padding: 0px" align="left"><button type="button" id="EDIT_BUTTON"><img src="../css/blueprint/plugins/buttons/icons/page_edit.png" alt=""/>编辑申报用户</button><button type="button" id="DELETE_BUTTON"><img src="../css/blueprint/plugins/buttons/icons/page_delete.png" alt=""/>删除申报用户</button></td>
        <td></td>
    </tr>
</table>
<table id="planUserDataTable" style="margin-top: 0px" width="98%" align="center" cellpadding="2" cellspacing="2">
    <thead>
        <tr>
        	<th width="10%">选择</th>
            <th width="20%">用户名</th>
            <th width="20%">用户单位</th>
            <th width="20%">方案名称</th>
            <th width="20%">状态</th>
        </tr>
    </thead>
    <tbody id="planUserDataBody">
    </tbody>
    <tbody id="pageBar">
        <tr>
            <td colspan="7" nowrap="nowrap" width="100%">
                <table>
                    <tbody>
                        <tr>
                            <td height="25"><button type="button" class="first-page"><img src="../css/blueprint/plugins/buttons/icons/resultset_first.png" alt=""/></button></td>
                            <td><button type="button" class="previous-page"><img src="../css/blueprint/plugins/buttons/icons/resultset_previous.png" alt=""/></button></td>
                            <td width="20%"><span class="page-index-selector" style=""></span></td>
                            <td><button type="button" class="next-page"><img src="../css/blueprint/plugins/buttons/icons/resultset_next.png" alt=""/></button></td>
                            <td><button type="button" class="last-page"><img src="../css/blueprint/plugins/buttons/icons/resultset_last.png" alt=""/></button></td>
                            <td><select class="page-size-selector">
                                    <option value="10" selected="selected">10</option>
                                    <option value="20">20</option>
                                    <option value="30">30</option>
                                </select></td>
                            <td width="80%">&nbsp;</td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
</form>
</body>
</html>